package com.sy.musicapp.model

import androidx.annotation.Keep


sealed class Screen(val route: String) {
    private companion object {
        private const val SplashScreen = "Splash"
        private const val LoginScreen = "Login"
        private const val HomeScreen = "Home"
        private const val SearchScreen = "Search"
        private const val PlayScreen = "Play"
        private const val PlaylistScreen = "Playlist"
    }

    override fun toString(): String {
        return route
    }

    object Splash : Screen(SplashScreen)
    object Login : Screen(LoginScreen)
    object Home : Screen(HomeScreen)
    object Search : Screen(SearchScreen)
    object Play : Screen(PlayScreen)
    object Playlist : Screen(PlaylistScreen)
}

enum class LoginWay {
    Phone, Email
}

//播放模式
enum class PlayMode {
    SINGLE_CYCLE,
    ALL_CYCLE,
    RANDOM_PLAY,
}

@Keep
data class BaseResponse(
    val msg: String,
    val code: Int,
)
@Keep
data class UserInfo(
    val code: Int,
    val userId: String,
    val nickname: String,
    var gender: Int,
    val avatarUrl: String,
    val signature: String?,
    val createTime: Long
) {
    companion object {
        val Empty = UserInfo(
            200,
            "",
            "",
            0,
            "http://p1.music.126.net/ry74RBuIQcNm6-SMTfa5-A==/109951164492189798.jpg",
            "这位用户很懒，什么都没有写",
            0
        )
    }
}

@Keep
data class HotKey(
    val code: Int,
    val showKeyword: String,
    val realkeyword: String
) {
    companion object {
        val Empty = HotKey(404, "要听点啥", "")
    }
}

@Keep
data class Music(
    val id: String = "",
    val name: String = "",
    val artist: String = "",
    val picUrl: String = "",
    val album: String = "", //专辑
    var url: String?,
    var duration: Int = 0,
    var type: String? = "mp3",
    var lyric: List<Lyric>? = listOf(),
    var size: Int = 0,
    var br: Int = 0,
    var fee: Int = 0, // 0:free 1:VIP 4:purchase 8:low_quality
    var isNext: Boolean = false
) {
    companion object {
        val Empty = Music(
            "",
            "MyMusic",
            "",
            "", //https://gitee.com/Tonyteachers/picture/raw/master/s_pixel_pic/zhongli.jpg
            "",
            null,
            0,
            "mp3",
            listOf(),
            0,
            0,
            0
        )
    }

    fun copy(): Music {
        return Music(
            id,
            name,
            artist,
            picUrl,
            album,
            url,
            duration,
            type,
            lyric,
            size,
            br,
            fee,
            isNext
        )
    }
}
@Keep
data class Playlist(
    val id: String,
    val name: String,
    val coverImgUrl: String,
    val trackCount: Int,
    val createTime: Long
) {
    companion object {
        val Empty = mutableListOf<Playlist>()
    }
}

@Keep
data class Banner(
    val id: String,
    val pic: String
) {
    companion object {
        val Empty = listOf<Banner>()
    }
}
@Keep
data class Lyric(val time: Int, val text: String) {
    companion object {
        val Empty = Lyric(0, "")
    }
}